home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / PGM_TOOL / PREVIEW / WYNFORM.PAS < prev   
Pascal/Delphi Source File  |  1995-11-10  |  2KB  |  73 lines

  1. unit Wynform;
  2.  
  3. interface
  4.  
  5. uses
  6.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  7.   Forms, Dialogs, StdCtrls, Buttons;
  8.  
  9. type
  10.   Tynform = class(TForm)
  11.     byes: TBitBtn;
  12.     bno: TBitBtn;
  13.     bok: TBitBtn;
  14.     Label1: TLabel;
  15.     bcancel: TBitBtn;
  16.     procedure FormCreate(Sender: TObject);
  17.     procedure FormClose(Sender: TObject; var Action: TCloseAction);
  18.   private
  19.     { Private declarations }
  20.   public
  21.     { Public declarations }
  22.         procedure Setup(style:integer;sCaption,sText:string);
  23.   end;
  24.  
  25. var
  26.   ynform: Tynform;
  27.  
  28. implementation
  29.  
  30. {$R *.DFM}
  31.  
  32. procedure Tynform.FormCreate(Sender: TObject);
  33. begin
  34.   width:=430;
  35.   height:=132;
  36.     top:=(screen.height-height) div 2;
  37.     left:=(screen.width-width) div 2;
  38. end;
  39.  
  40. procedure Tynform.Setup(style:integer;sCaption,sText:string);
  41. begin
  42.   if style=1 then begin  { OK box }
  43.     byes.visible:=false;
  44.     bno.visible:=false;
  45.     bcancel.visible:=false;
  46.   end;
  47.   if style=2 then begin  { Yes/no box }
  48.     bok.visible:=false;
  49.     byes.left:=109;
  50.     bno.left:=225;
  51.     byes.visible:=true;
  52.     bno.visible:=true;
  53.   end;
  54.   if style=3 then begin  { Yes/no/cancel box }
  55.     bok.visible:=false;
  56.     byes.left:=45;
  57.     bno.left:=166;
  58.     bcancel.left:=288;
  59.     byes.visible:=true;
  60.     bno.visible:=true;
  61.     bcancel.visible:=true;
  62.   end;
  63.   caption:=sCaption;
  64.   label1.caption:=sText;
  65. end;
  66.  
  67. procedure Tynform.FormClose(Sender: TObject; var Action: TCloseAction);
  68. begin
  69.   action:=caFree;
  70. end;
  71.  
  72. end.
  73.